﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using YJKSparseDistance.ModelLayer;
using YJKInspectModelFunc;
using YJKInspectModelFunc.ModelLayer;

namespace YJKSparseDisOfRoom.ModelLayer
{
	public class RoomCurveBean
	{
		internal RoomCurveBean(RoomNodePacker input)
		{
			this.UseNodePacker = input;
			this.m_useRoomPacker = this.UseNodePacker.ThisRoomPacker;
			int num = 0;
			bool ifCalculateInner = false;
			List<BaseCurveBean> list = new List<BaseCurveBean>();
			foreach (List<BaseBoundarySegmentPacker> list2 in this.m_useRoomPacker.LstLstBoundarySegmentPacker)
			{
				if (num.Equals(0))
				{
					ifCalculateInner = true;
				}
				list = new List<BaseCurveBean>();
				foreach (BaseBoundarySegmentPacker baseBoundarySegmentPacker in list2)
				{
					if (baseBoundarySegmentPacker.ThisElement is Wall)
					{
						Curve curve = ((baseBoundarySegmentPacker.ThisElement as Wall).Location as LocationCurve).Curve;
						if (baseBoundarySegmentPacker.UseTransform != null)
						{
							curve = curve.CreateTransformed(baseBoundarySegmentPacker.UseTransform);
						}
                        curve = YJKInspectModelFunc.Utility.TransformCurveAtZAixs(curve, this.m_useRoomPacker.ThisRoom.Level.Elevation, true);
						this.m_lstWallLocationCurves.Add(new BaseCurveBean(curve, false, true));
					}
					list.Add(new BaseCurveBean(baseBoundarySegmentPacker.BoundaryCurve, true, false));
				}
				CurveBeanUnit item = new CurveBeanUnit(list, ifCalculateInner);
				this.m_lstCurveBeanUnit.Add(item);
				num++;
				ifCalculateInner = false;
			}
		}

		public RoomPacker_EvacuationDistance UseRoomPacker
		{
			get
			{
				return this.m_useRoomPacker;
			}
			private set
			{
				this.m_useRoomPacker = value;
			}
		}

		public List<BaseCurveBean> LstWallLocationCurves
		{
			get
			{
				return this.m_lstWallLocationCurves;
			}
			private set
			{
				this.m_lstWallLocationCurves = value;
			}
		}

		public List<CurveBeanUnit> LstCurveBeanUnit
		{
			get
			{
				return this.m_lstCurveBeanUnit;
			}
			private set
			{
				this.m_lstCurveBeanUnit = value;
			}
		}

		public RoomNodePacker UseNodePacker
		{
			get
			{
				return this.m_useNodePacker;
			}
			private set
			{
				this.m_useNodePacker = value;
			}
		}

		private RoomPacker_EvacuationDistance m_useRoomPacker;

		private RoomNodePacker m_useNodePacker;

		private List<BaseCurveBean> m_lstWallLocationCurves = new List<BaseCurveBean>();

		private List<CurveBeanUnit> m_lstCurveBeanUnit = new List<CurveBeanUnit>();
	}
}
